using System.Collections.Generic;
using LiteTools.service.converters.data_parser.tlv;

namespace LiteTools.service.converters.data_parser
{
    public class ParserContainer
    {
        private static Dictionary<string, FormatType> _typesDict = new Dictionary<string, FormatType>
        {
            { TypeTlv.FormatType, new TypeTlv() },
            { TypeApdu.FormatType, new TypeApdu() },
            { TypeImix.FormatType, new TypeImix() },
        };

        /// <summary>
        /// 获取具体的解析器
        /// </summary>
        /// <param name="formatType"> 由UI传过来的格式化数据的种类， 比如TLV </param>
        /// <param name="category"> 由UI传递过来的具体类别，比如BER-TLV </param>
        /// <returns> 用来解析指定数据的解析器 </returns>
        public static SpecificParser GetParser(string formatType, string category)
        {
            var type = _typesDict[formatType];
            return type.GetParser(category);
        }
    }
}